package utils.getcode;

import java.util.HashMap;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;


public class BrowseUrlTool {   
    private static HttpClient client;   
    private static HttpGet getMethod;   

    public static String getText(String url) {   
    	client = new DefaultHttpClient();   
        getMethod = new HttpGet(url);   
        
        String text = null;   
        try {   
            HttpResponse response = client.execute(getMethod);  
            HttpEntity entity = response.getEntity();
            
            text = EntityUtils.toString(entity);

        } catch (Exception e) {   
            System.err.println(e);   
        }   
        return text;   
    }   

      
    
 
    public static void main(String[] args) {   
//    	getJsonText();
    	System.out.println(getText("http://www.google.com.hk"));
    }   
}  